package days48;

import java.util.Scanner;

public class Day27 {
////    static class thread1 extends Thread{
////        @Override
////        public void run() {
////            System.out.println("俺是线程1");
////        }
////    }
////
////    static class thread3  implements Runnable{
////        @Override
////        public void run() {
////            System.out.println("俺是线程3,用的是实现Runnable");
////        }
////    }
////
////    public static void main(String[] args) {
////        Thread thread4=new Thread(new Thread(){
////            @Override
////            public void run() {
////                System.out.println("俺是线程4,用的是匿名内部类的方式");
////            }
////        });
////        Thread thread2=new Thread(()->{
////            System.out.println("俺是线程2,用的是lambda表达式");
////        });
////        Thread thread5=new Thread(new Runnable() {
////            @Override
////            public void run() {
////                System.out.println("俺是线程5,用的是匿名内部类的方式实现runnable接口");
////            }
////        });
////        Thread thread1=new thread1();
////        Thread thread3=new Thread(new thread3());
////        thread1.start();
////        thread2.start();
////        thread3.start();
////        thread4.start();
////        thread5.start();
////    }
//
////    public static void main(String[] args) throws InterruptedException {
////        Thread[] threads=new Thread[20];
////        for (int i = 0; i < 20; i++) {
////            final int k=i;
////            threads[i]=new Thread(new Runnable() {
////                @Override
////                public void run() {
////                    System.out.println(k);
////                }
////            });
////
////        }
////        for (Thread t:threads) {
////            t.start();
////            t.join();
////        }
////        System.out.println("ok");
////
////    }
//    static volatile int count=0;
//
//    public static void main(String[] args) throws InterruptedException {
//        Object object1=new Object();
//        Thread thread1=new Thread(new Runnable() {
//            @Override
//            public void run() {
//                for (int i = 0; i < 10000; i++) {
//                    synchronized (object1){
//                        count++;
//                    }
//                }
//            }
//        });
//        Thread thread2=new Thread(new Runnable() {
//            @Override
//            public void run() {
//                for (int i = 0; i < 10000; i++) {
//                    synchronized (object1) {
//                        count++;
//                    }
//                }
//            }
//        });
//        thread1.start();
//        thread2.start();
//        thread1.join();
//        thread2.join();
//        System.out.println(count);
//    }

//    static boolean out(char c){
//        System.out.print(c);
//        return true;
//    }
public static int add(int a, int b) {
    while(b != 0) { // 当进位为 0 时跳出
        int c = (a & b) << 1;  // c = 进位
        a ^= b; // a = 非进位和
        b = c; // b = 进位
    }
    return a;
}
    public static int Add(int num1,int num2) {
        int c=0;
        while (num1!=0){
            c=num1^num2;
            num1&=num2;
            num1<<=1;
        }
        return c;
    }

    public static void main(String[] argv){

//        int i = 0;
//        for(out('A');out('B') && (i<2);out('C')){
//            i++;
//            out('D');
//        }
        Scanner scanner=new Scanner(System.in);

        Add(-1,1);
        System.out.println(add(-1, 1));
    }
}
